package com.niiwoo.civet.trade.dto;

import com.alibaba.fastjson.JSONObject;

import java.math.BigDecimal;

/**
 * @Description 提前还款金额
 * @Author YangJian
 * @Date 2015/11/6.
 */
public class PrepaymentAmountDTO {
    public static final int SUCCEED = 1;
    public static final int FAILURE = 0;

    // 0:失败 1:成功
    private int code;

    // 本金
    private BigDecimal principal;
    // 利息
    private BigDecimal interest;
    // 罚息
    private BigDecimal penalty;
    // 平台管理费
    private BigDecimal platformManagerFee;
    // 催收服务费
    private BigDecimal dunningServiceFee;
    // 信用保费（极速借平台管理费）
    private BigDecimal creditGuaranteeFee;
    // 节省金额
    private BigDecimal cutCosts;
    // 当前期
    private Integer currentPeriods;
    // 总期数
    private Integer totalPeriods;
    // 逾期天数
    private Integer overdueDay;

    public PrepaymentAmountDTO() {
        code = FAILURE;
        principal = BigDecimal.ZERO;
        interest = BigDecimal.ZERO;
        penalty = BigDecimal.ZERO;
        platformManagerFee = BigDecimal.ZERO;
        dunningServiceFee = BigDecimal.ZERO;
        creditGuaranteeFee = BigDecimal.ZERO;
        cutCosts = BigDecimal.ZERO;
        currentPeriods = 0;
        totalPeriods = 0;
        overdueDay = 0;
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public BigDecimal getPrincipal() {
        return principal;
    }

    public void setPrincipal(BigDecimal principal) {
        this.principal = principal;
    }

    public BigDecimal getInterest() {
        return interest;
    }

    public void setInterest(BigDecimal interest) {
        this.interest = interest;
    }

    public BigDecimal getPenalty() {
        return penalty;
    }

    public void setPenalty(BigDecimal penalty) {
        this.penalty = penalty;
    }

    public void addPrincipal(BigDecimal principal) {
        this.principal = this.principal.add(principal);
    }

    public void addInterest(BigDecimal interest) {
        this.interest = this.interest.add(interest);
    }

    public void addPenalty(BigDecimal penalty) {
        this.penalty = this.penalty.add(penalty);
    }

    public void addPlatformManagerFee(BigDecimal platformManagerFee) {
        this.platformManagerFee = this.platformManagerFee.add(platformManagerFee);
    }

    public BigDecimal getCutCosts() {
        return cutCosts;
    }

    public BigDecimal getPlatformManagerFee() {
        return platformManagerFee;
    }

    public void setPlatformManagerFee(BigDecimal platformManagerFee) {
        this.platformManagerFee = platformManagerFee;
    }

    public void setCutCosts(BigDecimal cutCosts) {
        this.cutCosts = cutCosts;
    }

    public void addCutCosts(BigDecimal cutCosts) {
        this.cutCosts = this.cutCosts.add(cutCosts);
    }

    public BigDecimal getDunningServiceFee() {
        return dunningServiceFee;
    }

    public void setDunningServiceFee(BigDecimal dunningServiceFee) {
        this.dunningServiceFee = dunningServiceFee;
    }

    public void addDunningServiceFee(BigDecimal dunningServiceFee) {
        this.dunningServiceFee = this.dunningServiceFee.add(dunningServiceFee);
    }

    public BigDecimal getCreditGuaranteeFee() {
        return creditGuaranteeFee;
    }

    public void setCreditGuaranteeFee(BigDecimal creditGuaranteeFee) {
        this.creditGuaranteeFee = creditGuaranteeFee;
    }

    public void addCreditGuaranteeFee(BigDecimal creditGuaranteeFee) {
        this.creditGuaranteeFee = this.creditGuaranteeFee.add(creditGuaranteeFee);
    }

    public Integer getCurrentPeriods() {
        return currentPeriods;
    }

    public void setCurrentPeriods(Integer currentPeriods) {
        this.currentPeriods = currentPeriods;
    }

    public Integer getTotalPeriods() {
        return totalPeriods;
    }

    public void setTotalPeriods(Integer totalPeriods) {
        this.totalPeriods = totalPeriods;
    }

    public Integer getOverdueDay() {
        return overdueDay;
    }

    public void setOverdueDay(Integer overdueDay) {
        this.overdueDay = overdueDay;
    }

    // 获取提前还款应还总金额
    public BigDecimal getAmount() {
        return principal.add(interest).add(penalty).add(platformManagerFee).add(dunningServiceFee).add(creditGuaranteeFee);
    }

    @Override
    public String toString() {
        return JSONObject.toJSONString(this);
    }
}
